<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- 条件渲染 v-if/v-else和v-show -->
    <div id="demo">
        <h2>条件渲染v-if/v-else</h2>
        <p v-if="ok">表白成功</p>
        <p v-else>表白失败</p>
        <hr>
        <h2>条件渲染v-show</h2>
        <p v-show="ok">求婚成功</p>
        <p v-show="!ok">求婚失败</p>
        <hr>
        <button @click="toggle">切换</button>
    </div>
    <script src="../day02/js/vue.js"></script>
    <script>
        new Vue({
            el:'#demo',
            data:{
                ok: true,
            },
            methods:{
                toggle(){
                    this.ok = !this.ok;
                }
            }
        })
    </script>
</body>
</html>